package com.cjzuji.rental.controller.order;


import com.cjzuji.rental.Bean.excelData.YouPingExces;
import com.cjzuji.rental.dao.OrderBillDao;
import com.cjzuji.rental.dao.OrderContractDao;
import com.cjzuji.rental.dao.OrderDao;
import com.cjzuji.rental.dao.OrderUserDao;
import com.cjzuji.rental.mapper.OrderMapper;

import com.cjzuji.rental.service.OrderService;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;
import java.io.File;


/**
 * @author bag
 * @version V1.0
 * @date 2025/7/7 14:53
 * @since 1.0
 */
//上一个Order应该是拿来分页的
@RestController
@RequestMapping("/order/youping2")
public class OrdersController {
    @Autowired
    OrderService orderService;

    private static final Logger logger = LoggerFactory.getLogger(OrdersController.class);

    //分页查询
    //http://127.0.0.1:9099/order/youping2/getOrderpage
    @GetMapping("/getOrderpage")
    public Object getOrderspage(@RequestParam(defaultValue = "") String userName){

        //        File outputFile = orderService.downLoadFile(arrayList, outputPath);
        // 4. 生成新的Excel文件并保存到本地
        File outputFile = orderService.getOrdersFile(userName);
        return ResponseEntity.ok("文件处理成功，已保存到: " + outputFile.getAbsolutePath());
    }
}

